package com.zhaoxi.project.wms.controller;

import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhaoxi.framework.aspectj.lang.annotation.Log;
import com.zhaoxi.framework.aspectj.lang.enums.BusinessType;
import com.zhaoxi.project.wms.domain.WmsWorkshopLine;
import com.zhaoxi.project.wms.service.impl.WmsWorkshopLineServiceImpl;
import com.zhaoxi.framework.web.BaseService;
import com.zhaoxi.framework.web.PageData;
import com.zhaoxi.common.utils.poi.ExcelUtil;

/**
 * 厂区|生产车间l生产流水线Controller
 *
 * @author zhaoxi
 * @date 2023-11-10
 */
@RestController
@RequestMapping("/wms/workShopLine")
public class WmsWorkshopLineController extends BaseService
{
    @Autowired
    private WmsWorkshopLineServiceImpl wmsWorkshopLineService;

    /**
     * 查询厂区|生产车间l生产流水线列表
     */
    @PreAuthorize("@ss.hasPermi('wms:workShopLine:list')")
    @GetMapping("/list")
    public PageData list(WmsWorkshopLine wmsWorkshopLine)
    {
        List<WmsWorkshopLine> list = wmsWorkshopLineService.selectWmsWorkshopLineList(wmsWorkshopLine);
        return success(list);
    }

    /**
     * 导出厂区|生产车间l生产流水线列表
     */
    @PreAuthorize("@ss.hasPermi('wms:workShopLine:export')")
    @Log(title = "厂区|生产车间l生产流水线", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WmsWorkshopLine wmsWorkshopLine)
    {
        List<WmsWorkshopLine> list = wmsWorkshopLineService.selectWmsWorkshopLineList(wmsWorkshopLine);
        ExcelUtil<WmsWorkshopLine> util = new ExcelUtil<WmsWorkshopLine>(WmsWorkshopLine.class);
        util.exportExcel(response, list, "厂区|生产车间l生产流水线数据");
    }

    /**
     * 获取厂区|生产车间l生产流水线详细信息
     */
    @PreAuthorize("@ss.hasPermi('wms:workShopLine:query')")
    @GetMapping(value = "/{id}")
    public PageData getInfo(@PathVariable("id") Long id)
    {
        return success(wmsWorkshopLineService.selectWmsWorkshopLineById(id));
    }

    /**
     * 新增厂区|生产车间l生产流水线
     */
    @PreAuthorize("@ss.hasPermi('wms:workShopLine:add')")
    @Log(title = "厂区|生产车间l生产流水线", businessType = BusinessType.INSERT)
    @PostMapping
    public PageData add(@RequestBody WmsWorkshopLine wmsWorkshopLine)
    {
        return toAjax(wmsWorkshopLineService.insertWmsWorkshopLine(wmsWorkshopLine));
    }

    /**
     * 修改厂区|生产车间l生产流水线
     */
    @PreAuthorize("@ss.hasPermi('wms:workShopLine:edit')")
    @Log(title = "厂区|生产车间l生产流水线", businessType = BusinessType.UPDATE)
    @PutMapping
    public PageData edit(@RequestBody WmsWorkshopLine wmsWorkshopLine)
    {
        return toAjax(wmsWorkshopLineService.updateWmsWorkshopLine(wmsWorkshopLine));
    }

    /**
     * 删除厂区|生产车间l生产流水线
     */
    @PreAuthorize("@ss.hasPermi('wms:workShopLine:remove')")
    @Log(title = "厂区|生产车间l生产流水线", businessType = BusinessType.DELETE)
	@DeleteMapping("/{id}")
    public PageData remove(@PathVariable Long id)
    {
        return toAjax(wmsWorkshopLineService.deleteWmsWorkshopLineByIds(id));
    }
}
